<div class="easyui-layout" data-options="fit:true">
    <form id="editFrom" method="post">
        <input type="hidden" name="id" id="mediaId">
        <div data-options="region:'center'">
            <div class="easyui-tabs">
                <div title="基本信息">
                    <table class="inputTable">
                        <tr>
                            <td>栏目</td>
                            <td>
                                <input class="easyui-combobox" name="category"
                                       data-options="url:'/dictionary/mediaType'" required missingMessage="请选择栏目">
                                <span style="color: red;">*</span>
                            </td>
                        </tr>
                        <tr>
                            <td>标题</td>
                            <td>
                                <input name="title" class="easyui-validatebox" data-options="required:true"
                                       maxlength="10" missingMessage="请输入标题">
                                <span style="color: red;">*</span>
                            </td>
                        </tr>
                        <tr>
                            <td>来源</td>
                            <td>
                                <input name="source" class="easyui-validatebox" data-options="required:true"
                                       maxlength="10" missingMessage="请输入来源">
                                <span style="color: red;">*</span>
                            </td>
                        </tr>
                        <tr>
                            <td>问题描述</td>
                            <td>
                                <textarea name="preview" style="height: 50px" class="easyui-validatebox"
                                          data-options="required:true" maxlength="100"
                                          missingMessage="请输入问题描述"></textarea>
                                <span style="color: red;">*</span>
                            </td>
                        </tr>
                        <tr>
                            <td>状态</td>
                            <td>
                                <input style="width: auto" type="radio" name="state" value="01">发布</input>
                                <input style="width: auto" type="radio" name="state" value="02">草稿</input>
                            </td>
                        </tr>
                        <tr>
                            <td>封面</td>
                            <td>
                                <div id="uploader" class="wu-example">
                                    <!--用来存放文件信息-->
                                    <div class="btns">
                                        <div id="picker">点击选择图片</div>
                                    </div>
                                    <div id="imglist" class="uploader-list bdup" urlname="previewImg"></div>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
                <div title="文章内容">
                    <!-- 加载编辑器的容器 -->
                    <script id="container" name="content" type="text/plain"></script>
                </div>
            </div>
        </div>
    </form>
    <div data-options="region:'south',border:false" style="text-align:right;padding:5px">
        <a class="easyui-linkbutton update" data-options="iconCls:'fa fa-save'" href="javascript:;"
           style="width:80px">更新</a>
        <a class="easyui-linkbutton" data-options="iconCls:'fa fa-close '" href="javascript:;"
           onclick="javascript:$('#win').window('close')" style="width:80px">取消</a>
    </div>
</div>
<script type="text/javascript" src="/static/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="/static/ueditor/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="/static/webuploader-0.1.5/bdup.js"></script>
<script>
    var option = {
        imgList: "#imglist", pick: {id: "#picker", multiple: false}, inputName: "previewImg"
    };
    bdup(option);
    var ue = UE.getEditor('container', {
        toolbars: [[
            'undo', //撤销
            'redo', //重做
            'bold', //加粗
            'indent', //首行缩进
            'italic', //斜体
            'underline', //下划线
            'strikethrough', //删除线
            'subscript', //下标
            'fontborder', //字符边框
            'superscript', //上标
            'formatmatch', //格式刷
            'blockquote', //引用
            'pasteplain', //纯文本粘贴模式
            'selectall', //全选
            'print', //打印
            'preview', //预览
            'horizontal', //分隔线
            'removeformat', //清除格式
            'time', //时间
            'date', //日期
            'fontfamily', //字体
            'fontsize', //字号
            'paragraph', //段落格式
            'simpleupload', //单图上传
            'link', //超链接
            'spechars', //特殊字符
            'searchreplace', //查询替换
            'insertvideo', //视频
            'justifyleft', //居左对齐
            'justifyright', //居右对齐
            'justifycenter', //居中对齐
            'justifyjustify', //两端对齐
            'forecolor', //字体颜色
            'backcolor', //背景色
            'fullscreen', //全屏
            'directionalityltr', //从左向右输入
            'directionalityrtl', //从右向左输入
            'rowspacingtop', //段前距
            'rowspacingbottom', //段后距
            'pagebreak', //分页
            'attachment', //附件
            'lineheight', //行间距
            'edittip ', //编辑提示
            'customstyle', //自定义标题
            'autotypeset', //自动排版
            'touppercase', //字母大写
            'tolowercase', //字母小写
            'background', //背景
            'template', //模板
        ]],
        //focus时自动清空初始化时的内容
        autoClearinitialContent: true,
        //关闭字数统计
        wordCount: false,
        //关闭elementPath
        elementPathEnabled: false,
        initialFrameHeight: 400,
        initialFrameWidth: 795,
        autoHeightEnabled: false,
        wordCount: true,
        maximumWords: 10000
        //更多其他参数，请参考ueditor.config.js中的配置项
    });
</script>
<script type="text/javascript" charset="utf-8">

    ue.ready(function () {
        var mediaId = $("#mediaId").val();
        $.get("/media/edit", {id: mediaId}, function (msg) {
            if (msg.state == "SUCCESS") {
                var data = msg.data.content;
                //异步回调
                ue.execCommand('insertHtml', data);
                //                $('#container').setContent(data);

            } else {
                $.messager.show({
                    title: '操作提示',
                    msg: msg.message,
                    timeout: 2000,
                    showType: 'slide'
                });
            }
        })

    });


</script>
